﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _06_FindFirstBiggestThenNeighbours
{
    class Program
    {
        static bool IsBiggerThenNeighbours(int[] searchedArray, int numberIndex)
        {
            if (numberIndex <= 0)
            {
                return false;
            }
            if (numberIndex >= searchedArray.Length - 1)
            {
                return false;
            }

            if (searchedArray[numberIndex] > searchedArray[numberIndex - 1] &&
                searchedArray[numberIndex] > searchedArray[numberIndex + 1])
            {
                return true;
            }

            return false;
        }
        static void Main(string[] args)
        {
            int[] firstArray = { 1, 3, 3, 4, 4, 1, 1, 2, 1, 2 };
            
            for (int index = 0; index < firstArray.Length; index++)
            {
                if (IsBiggerThenNeighbours(firstArray, index))
                {
                    Console.WriteLine(index);
                    return;
                } 
            }
            Console.WriteLine(-1);

        }
    }
}
